﻿@using GP.Logic.Model
@model Citizen
@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm(MVC.Citizen.Edit()))
{ 
    <p>
        Citizen Id: @Html.DisplayFor(a => a.CitizenId)
        @Html.HiddenFor(a => a.CitizenId)
    </p>
    <p>
        Time created: @Html.DisplayFor(a => a.TimeCreated)
    </p>
    <p>
        Name:
        @Html.EditorFor(a => a.Name)
        @Html.ValidationMessageFor(a => a.Name)
    </p>
    <p>
        Doctor:
        @Html.EditorFor(a => a.DocId, "Doctor")
    </p>
    <p>
        Social Security: 
        @Html.EditorFor(a => a.SocialSecurity)
        @Html.ValidationMessageFor(a => a.SocialSecurity)
    </p>
    <p>
        Phone: 
        @Html.EditorFor(a => a.Phone)
        @Html.ValidationMessageFor(a => a.Phone)
    </p>
    <p>
        Email: 
        @Html.EditorFor(a => a.Email)
        @Html.ValidationMessageFor(a => a.Email)
    </p>
    <p>
        PassKey: 
        @Html.EditorFor(a => a.PassKey)
        @Html.ValidationMessageFor(a => a.PassKey)
    </p>
    <p>
        <input type="submit" value="Save" />
    </p>
}

<fieldset>
    <legend>Granted Access To</legend>
    @foreach(var item in Model.GratedAccessTos)
    {
        <text>
            @item.Doctor.Name which expires @item.Expires.ToString("dd-MM-yyyy")
            <br />
        </text>
    }
</fieldset>
<p>
    @Html.ActionLink("Edit access", MVC.Citizen.Access(Model.CitizenId))
</p>